package com.flysky.model.finance;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="flysky_finance")
public class FinanceHbmModel implements Serializable{

	/**
	 * @author kp18166
	 */
	private static final long serialVersionUID = 1L;
	
	private String financeId;
	
	private String maker;
	
	private String cost;
	
	private String income;
	
	private Date financeDate;
	
	private Date createDate;
	
	private double money;
	
	private String remark;
	
	private String location;
	
	private SmallTypeHbmModel smallType;
	
	@GenericGenerator(name="generator", strategy="uuid")
	@Id
	@GeneratedValue(generator="generator")
	@Column(name="UUID", unique=true,nullable=false,length=50)
	public String getFinanceId() {
		return financeId;
	}
	
	public void setFinanceId(String financeId) {
		this.financeId = financeId;
	}
	
	@Column(name="MAKER")
	public String getMaker() {
		return maker;
	}
	
	public void setMaker(String maker) {
		this.maker = maker;
	}
	
	@Column(name="COST_TYPE")
	public String getCost() {
		return cost;
	}
	
	public void setCost(String cost) {
		this.cost = cost;
	}
	@Column(name="INCOME_TYPE")
	public String getIncome() {
		return income;
	}
	
	public void setIncome(String income) {
		this.income = income;
	}
	@Column(name="FINACE_DATE")
	public Date getFinanceDate() {
		return financeDate;
	}
	
	public void setFinanceDate(Date financeDate) {
		this.financeDate = financeDate;
	}
	
	@Column(name="CREATE_DATE")
	public Date getCreateDate() {
		return createDate;
	}
	
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	@Column(name="MONEY")
	public double getMoney() {
		return money;
	}
	
	public void setMoney(double money) {
		this.money = money;
	}
	
	@Column(name="REMARK")
	public String getRemark() {
		return remark;
	}
	
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(name="LOCATION")
	public String getLocation() {
		return location;
	}
	
	public void setLocation(String location) {
		this.location = location;
	}
	
	@ManyToOne(targetEntity=SmallTypeHbmModel.class,cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})
	@JoinColumn(name="FINACE_TYPE" )
	public SmallTypeHbmModel getSmallType() {
		return smallType;
	}
	
	public void setSmallType(SmallTypeHbmModel smallType) {
		this.smallType = smallType;
	}
	
	@Override
	public String toString() {
		return "FinanceHbmModel [financeId=" + financeId + ", maker=" + maker
				+ ", cost=" + cost + ", income=" + income + ", financeDate="
				+ financeDate + ", createDate=" + createDate + ", money="
				+ money + ", remark=" + remark + ", location=" + location
				+ ", financeType=" + smallType + "]";
	}

	
}
